<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateTableNosplitAuthority extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $prefix = env('DB_PREFIX');
        $tableName = 'nosplit_authority';
        Schema::create($tableName, function (Blueprint $table) {
            $table->increments('id')->comment('权限ID');
            $table->string('name', 255)->comment('权限名称');
            $table->integer('type')->comment('权限类型:{1:接口权限, 2:元素权限}');
            $table->integer('module_id')->comment('所属模块');
            $table->timestamps();

        });
        DB::statement("ALTER TABLE ".$prefix.$tableName. " comment '权限表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('nosplit_authority');
    }
}
